Public Class SearchCriteria
    Private _SearchProperty As String
    Public Property SearchProperty() As String
        Get
            Return _SearchProperty
        End Get
        Set(ByVal value As String)
            _SearchProperty = value
        End Set
    End Property

    Private _SearchOperator As String
    Public Property SearchOperator() As SearchOperators
        Get
            Return _SearchOperator
        End Get
        Set(ByVal value As SearchOperators)
            _SearchOperator = value
        End Set
    End Property

    Private _SearchValue As String
    Public Property SearchValue() As String
        Get
            Return _SearchValue
        End Get
        Set(ByVal value As String)
            _SearchValue = value
        End Set
    End Property
End Class

Public Enum SortOrder
    Ascending = 0
    Descending = 1
End Enum

Public Enum SearchOperators
    Equals = 0
    GreaterThan = 1
    LessThan = 2
    GeaterThanOrEqualTo = 3
    LessThanOrEqualTo = 4
    StartsWith = 5
    EndsWith = 6
    Contains = 7
End Enum

Public Class SearchHelpers
    Public Shared Function GetDBWhereClause(ByVal ColumnName As String, ByVal SearchOperator As KDESolutions.Providers.DataProvider.SearchOperators, ByVal SearchValue As String) As String
        Dim returnString As String = String.Empty
        Select Case SearchOperator
            Case SearchOperators.Contains
                returnString = ColumnName & " LIKE '%" & SearchValue & "%'"
            Case SearchOperators.EndsWith
                returnString = ColumnName & " LIKE '%" & SearchValue & "'"
            Case SearchOperators.Equals
                returnString = ColumnName & " = '" & SearchValue & "'"
            Case SearchOperators.GeaterThanOrEqualTo
                returnString = ColumnName & " >= '" & SearchValue & "'"
            Case SearchOperators.GreaterThan
                returnString = ColumnName & " > '" & SearchValue & "'"
            Case SearchOperators.LessThan
                returnString = ColumnName & " < '" & SearchValue & "'"
            Case SearchOperators.LessThanOrEqualTo
                returnString = ColumnName & " <= '" & SearchValue & "'"
            Case SearchOperators.StartsWith
                returnString = ColumnName & " LIKE '" & SearchValue & "%'"
            Case Else
                Throw New Exception("The operator you specified in your search criteria is invalid for this datatype.")
        End Select
        Return returnString
    End Function
End Class